﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Demo.Converters
{
    public class BooleanToBrush : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if ((Boolean)value)
            {
                return App.Current.Resources["GreenBrushKey"];
            }
            else
            {
                return App.Current.Resources["RedBrushKey"];
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
